﻿using System;
using System.Collections.Generic;
using System.Text;
using Newtonsoft.Json.Linq;

namespace DotNetExtensions.Core.Helpers
{
	public class JTokenTypeConverter
	{
		public static Type Change(JTokenType type)
		{
			switch (type)
			{
				case JTokenType.Boolean: return typeof(bool);
				case JTokenType.Bytes: return typeof(byte);
				case JTokenType.String: return typeof(string);
				case JTokenType.Array: return typeof(object[]);
				case JTokenType.Date: return typeof(DateTime);
				case JTokenType.Float: return typeof(float);
				case JTokenType.Object: return typeof(object);
				case JTokenType.Integer: return typeof(int);
				case JTokenType.TimeSpan: return typeof(TimeSpan);
				case JTokenType.Null: return null;
				case JTokenType.None: return null;
				case JTokenType.Guid: return typeof(Guid);
				case JTokenType.Raw: return typeof(string);
			}
			return typeof(object);
		}
	}
}
